<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Renting extends Base
{
    //读取器
    public function getPhoneAttribute($key)
    {
        return !empty($this->attributes['phone']) ?$this->attributes['phone']:'无';
    }

    //访问器
    public function getCardImgAttribute()
    {
        $imglist = explode('#',$this->attributes['card_img']);
        return array_map(function($item){
            return ['pic' => $item,'url' => config('url.domain') . $item];
        },$imglist);
    }
}
